package k2_oop.p7_javaLang.demo01;

public class UserString {
    public static void main(String[] args) {

        String s1 = "hello world";
        String s2 = "hello world";
        String s3 = new String("hello world");

        String s4 = s1+"!";
        String s5 = "hello world!";

        String s6 = "hello "+"world!";

        System.out.println(s1==s2);
        System.out.println(s1==s3);
        System.out.println(s2==s3);
        System.out.println(s4==s5);
        System.out.println(s4==s5);
        System.out.println(s6==s5);


        long startTime = System.currentTimeMillis();
//        String s7 = "";
        StringBuffer sb = new StringBuffer();
        StringBuilder sb1 = new StringBuilder();
        for (int i = 0; i < 1000000; i++) {
            sb1.append("hello");
        }
        long endTime = System.currentTimeMillis();

        System.out.println("消耗的时间："+(endTime-startTime));


    }
}
